﻿<Window x:Class="Neurokinetic.Electroencephalograph.View.ElectroencephalographView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:nsnm="clr-namespace:Neurokinetic.NeuroSkyNet.Model;assembly=NeuroSkyNet"
        xmlns:nsnc="clr-namespace:Neurokinetic.NeuroSkyNet.Controller;assembly=NeuroSkyNet"
        xmlns:vm="clr-namespace:Neurokinetic.Electroencephalograph.ViewModel"
        xmlns:nsc="clr-namespace:Neurokinetic.MindSetControls;assembly=MindSetControls"
        Name="wdwElectroencephalographView" 
        Title="Electroencephalograph" Margin="0" Padding="0" Height="656" MaxHeight="656" MinHeight="656" Width="1120" MaxWidth="1120" MinWidth="1120">
        <Window.Resources>
            <vm:MindSetsViewModel x:Key="MindSetsViewModel" />
        </Window.Resources>
        <StackPanel Orientation="Vertical" >
            <StackPanel Orientation="Horizontal" Name="spTop" VerticalAlignment="Top" HorizontalAlignment="Right">
                <TextBlock DataContext="{Binding ElementName=wdwElectroencephalographView, Path=MindSet}">
                   Battery:<TextBlock Text="{Binding Battery.Current}" ></TextBlock> | 
                   Signal:<TextBlock Text="{Binding Signal.Current}" ></TextBlock> | 
                   Port:<TextBlock Text="{Binding Port}" ></TextBlock> | 
                   Connection ID:<TextBlock Text="{Binding ConnectionID}" ></TextBlock>
                   Ticks:<TextBlock Text="{Binding Ticks}" ></TextBlock>
                </TextBlock>
                <TextBlock>  [
                <TextBlock Text="{Binding Source={StaticResource MindSetsViewModel},Path=Information}" ></TextBlock>
                ]</TextBlock>
            </StackPanel>
            <ItemsControl ItemsSource="{Binding MindSet}" DataContext="{Binding ElementName=wdwElectroencephalographView}">
            <ItemsControl.ItemContainerStyle>
                <Style>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding DataType}" Value="Battery">
                            <Setter Property="Control.Visibility" Value="Collapsed" />
                        </DataTrigger>
                        <DataTrigger Binding="{Binding DataType}" Value="Signal">
                            <Setter Property="Control.Visibility" Value="Collapsed" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </ItemsControl.ItemContainerStyle>
            <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal" />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate DataType="{x:Type nsnm:MindSetDataModel}">
                        <StackPanel Width="100" HorizontalAlignment="Center">
                            <TextBlock Text="{Binding DataType}" />
                            <TextBlock Text="{Binding Lowest}" />
                            <TextBlock Text="{Binding Current}" />
                            <TextBlock Text="{Binding Highest}" />
                            <TextBlock Text="{Binding Ticks}" />
                        </StackPanel>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
            <ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Auto" Height="550">
                <ItemsControl ItemsSource="{Binding MindSet}" Name="PolylineGraphs" DataContext="{Binding ElementName=wdwElectroencephalographView}">
                    <ItemsControl.ItemContainerStyle>
                        <Style>
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding DataType}" Value="Battery">
                                    <Setter Property="Control.Visibility" Value="Collapsed" />
                                </DataTrigger>
                                <DataTrigger Binding="{Binding DataType}" Value="Signal">
                                    <Setter Property="Control.Visibility" Value="Collapsed" />
                                </DataTrigger>
                        </Style.Triggers>
                        </Style>
                    </ItemsControl.ItemContainerStyle>
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel Orientation="Horizontal" />
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.ItemTemplate>
                        <DataTemplate DataType="{x:Type nsnm:MindSetDataModel}">
                            <nsc:PolylineGraph MinHeight="550" Background="Black" Width="100" Stroke="Red" Name="polylineGraph"  MindSet="{Binding ElementName=wdwElectroencephalographView, Path=MindSet}" DataType="{Binding DataType}" />
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
            </ItemsControl>
            </ScrollViewer>
        </StackPanel>
</Window>
